﻿
namespace com.magickms.common
{
    public class ListModel<T>
    {
        private T _k;
        private string _v;

        public ListModel()
        {
        }

        public ListModel(T k, string v)
        {
            _k = k;
            _v = v;
        }

        public override string ToString()
        {
            return _v;
        }

        public T K
        {
            get
            {
                return _k;
            }
            set
            {
                _k = value;
            }
        }

        public string V
        {
            get
            {
                return _v;
            }
            set
            {
                _v = value;
            }
        }

        public override bool Equals(object obj)
        {
            if (obj is ListModel<T>)
            {
                ListModel<T> k = (ListModel<T>)obj;
                return _k.Equals(k.K);
            }
            if (obj is T)
            {
                T k = (T)obj;
                return _k.Equals(k);
            }
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return _k.GetHashCode();
        }
    }
}
